﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcSite.Models;

namespace MvcSite.Controllers
{
    public class NavigationController : Controller
    {
        public ActionResult Navigation()
        {
            string url = Request.UrlReferrer.PathAndQuery.Split('/')[1];
            AdminPage pagina = (AdminPage)Enum.Parse(typeof(AdminPage), url);
            switch (pagina)
            {
                case AdminPage.Index:
                    {
                        return Redirect(Indirizzi.GetIndirizzo(AdminPage.Index));
                    }
                case AdminPage.Album:
                    {
                        return Redirect(Indirizzi.GetIndirizzo(AdminPage.Album));
                    }
                case AdminPage.Notizie:
                    {
                        return Redirect(Indirizzi.GetIndirizzo(AdminPage.Notizie));
                    }
                case AdminPage.Utenti:
                    {
                        return Redirect(Indirizzi.GetIndirizzo(AdminPage.Utenti));
                    }
                default:
                    {
                        return Redirect(Indirizzi.GetIndirizzo(AdminPage.Index));
                    }
            }
        }

    }
}
